package cn.market.web.action.user;

import java.util.List;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.springframework.stereotype.Controller;

import cn.market.bean.user.Address;
import cn.market.service.user.AddressService;

@Controller("/address/list")
public class AddressAction extends Action {
	@Resource(name="addressServiceBean")
	private AddressService service = null;
	@Override
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) throws Exception {
		List<Address> addresses = service.getAllTopParent();
		request.setAttribute("addresses", addresses);
		request.setAttribute("message", "list");
		return mapping.findForward("list");
	}
}
